package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.api.domain.dto.GameAllRankingListLogDTO;
import com.juyu.miliao.api.domain.vo.GameRankingListLogVO;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Auther: 卜加超
 * @Date: 2019/8/21 15:45
 * @Description:
 */
@Repository
public class GameAllRankingListLogDao {
    @Resource
    private SqlSession sqlSession;

    public List<GameRankingListLogVO> getGameRankingListLog(long userId, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>(4);
        map.put("userId", userId);
        map.put("startTime", startTime);
        map.put("endTime",endTime);
        return sqlSession.selectList("getGameRankingListLog",map);
    }
    public int saveGameAllRankingListLog(GameAllRankingListLogDTO gameAllRankingListLog) {
        return   sqlSession.insert("saveGameAllRankingListLog",gameAllRankingListLog);
    }

    public GameRankingListLogVO getGameRankingListLogByUserIdAndTime(Long userId, String rankingDate) {
        Map<String, Object> map = new HashMap<>(4);
        map.put("userId", userId);
        map.put("rankingDate", rankingDate);
        return sqlSession.selectOne("getGameRankingListLogByUserIdAndTime",map);
    }
}
